/*
 * @lc app=leetcode.cn id=9 lang=cpp
 *
 * [9] 回文数
 */

// @lc code=start
#include <string>
#include <sstream>
using namespace std;
class Solution
{
public:
    bool isPalindrome(int x)
    {
        if(x < 0)
            return false;
        unsigned int y = 0; // 这里使用无法符号的，防止反向时溢出，比如1234567899，反转时就会溢出
        unsigned int tem = x;
        while (tem != 0)
        {
            y = y * 10 + tem % 10;
            tem = tem / 10;
        }

        return y == x;
    }
};
// @lc code=end
